﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Main_Data;
using Common;

namespace Print_UI
{
    public class CommonForm : DevExpress.XtraEditors.XtraForm, ICommonForm
    {
        public DataEntities Model
        {
            get { return LocalValues.Model; }
        }

        public void RefreshModel()
        {
            LocalValues.RefreshModel();
        }

        public bool IsAdmin
        {
            get { return GlobalValues.IsAdmin; }
            set { GlobalValues.IsAdmin = value; }
        }

        public string UserName
        {
            get { return GlobalValues.UserName; }
            set { GlobalValues.UserName = value; }
        }

        public string LastName
        {
            get { return GlobalValues.LastName; }
            set { GlobalValues.LastName = value; }
        }

        public string FirstName
        {
            get { return GlobalValues.FirstName; }
            set { GlobalValues.FirstName = value; }
        }

        public int GroupID
        {
            get { return GlobalValues.GroupID; }
            set { GlobalValues.GroupID = value; }
        }

        public int DepartmentID
        {
            get { return GlobalValues.DepartmentID; }
            set { GlobalValues.DepartmentID = value; }
        }

        public string DepartmentName
        {
            get { return GlobalValues.DepartmentName; }
            set { GlobalValues.DepartmentName = value; }
        }

        public void CommonError(Exception ex)
        {
            DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Message");
        }

        public void CommonMessage(string content)
        {
            DevExpress.XtraEditors.XtraMessageBox.Show(content, "Message");
        }

        protected void CommonMessage(string content, string title)
        {
            DevExpress.XtraEditors.XtraMessageBox.Show(content, title);
        }

        protected bool CommonConfirm(string content, string title)
        {
            return DevExpress.XtraEditors.XtraMessageBox.Show(content, title, System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes;
        }

        public string[] Actions { get; set; }
    }
}
